import React, { Component } from 'react'
// 导入实例对象 new EventEmitter()
import eventbus from './myevents';
console.log('eventbus', eventbus)
export default class Child1 extends Component {
    state = {
        username: '大师兄'
    }
    render() {
        return (
            <div onClick={() => {
                // 语法:  eventbus.emit('自定义事件', 要传递的数据)
                eventbus.emit('myevent1', this.state.username)
            }}>Child1</div>
        )
    };
}
